home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Windows Selection / Windows Selection 1.iso / Graphics / Formula Graphics Multimedia System / EXAMPLE.SXT < prev    next >
Encoding:
Text File  |  1996-06-24  |  3.2 KB  |  140 lines

  1. ///////////////////////
  2. // Example script
  3. // Harrow Software 96
  4. //
  5.  
  6. /////////////////////////////////
  7. // General Initializers
  8. //
  9.  
  10. init_dialog:
  11.     for n = 1 to 10
  12.         listbox "list box" add "selection ",n
  13.     editbox "multiline edit" = "This information has been sent to the edit box by the script"
  14.  
  15. editbox_handler: element_name, contents
  16.     dialog "single edit" ok "Hello ",$contents
  17.  
  18. listbox_handler: element_name, selection, select_position
  19.     dialog "list box" ok "You chose ",$selection
  20.  
  21. draw_3D_graph:
  22.     the_graph = new script "graph3d.sxt"
  23.     the_graph call display_graph
  24.     free the_graph
  25.  
  26. start_calculator:
  27.     calculator = new script "calc.sxt"
  28.     calculator call init_calculator
  29.  
  30. start_game:
  31.     the_game = new script "game_1.sxt"
  32.     the_game call start_game
  33.     free the_game
  34.  
  35. ///////////////////////////////
  36. // Spaceship controls
  37. //
  38.  
  39. space_initialize:
  40.     break mode FALSE
  41.     the_spaceship = new script "starwar.sxt"
  42.     the_spaceship call initialize
  43.  
  44. space_mouse_move: x, y
  45.     the_spaceship call draw_angle: x, y
  46.  
  47. space_cleanup:
  48.     free the_spaceship
  49.  
  50. ///////////////////////////////
  51. // Hypertext controls
  52. //
  53.  
  54. hypertext_init:
  55.     p1 = 0        // record history
  56.  
  57. hypertext_handler: element_name, topic, hlink, p
  58.     editbox "edit box" = "Page ",p," - ",$topic
  59.     p2 = p1
  60.     p1 = p
  61.  
  62. hypertext_page:
  63.     display hypertext "sample.fgh" page p
  64.  
  65. hypertext_search:
  66.     search hypertext "sample.fgh"
  67.  
  68. ///////////////////////////////////////////////
  69. // Initialize graph data and color arrays
  70. //
  71.  
  72. init_graphs:
  73.  
  74. // generate an arrays of single and multiple series graph data
  75.  
  76.     my_single_data = new float[10]
  77.     for n = 0 to 9
  78.         my_single_data[n] = rnd 100 // random values 0 to 100
  79.  
  80.     my_multi_data = new float[3][10]
  81.     for n,m = 0,0 to 2,9
  82.         my_multi_data[n][m] = rnd 100    // random values 0 to 100
  83.  
  84.     my_stacked_data = new float[3][10]
  85.     for m = 0 to 9
  86.         total = 0
  87.         for n = 0 to 2
  88.             total = total + my_multi_data[n][m]
  89.         for n = 0 to 2
  90.             my_stacked_data[n][m] = my_multi_data[n][m] / total * 100
  91.  
  92. // generate pie graph data
  93.  
  94.     my_pie_data = new float[6]
  95.     total = 0
  96.     for n = 0 to 5
  97.         my_pie_data[n] = 10 + rnd 10 // random values 10 to 20
  98.         total = total + my_pie_data[n]
  99.     for n = 0 to 5
  100.         my_pie_data[n] = (my_pie_data[n] / total * 100) ~ 3
  101.             // ~ 3 - only three significant digits
  102.  
  103. // generate an array of colors
  104.  
  105.     my_colors = new byte[6][3]
  106.     my_colors[0][0] = 0,128,192 // blue
  107.     my_colors[1][0] = 192,96,128 // pink
  108.     my_colors[2][0] = 96,192,96 // green
  109.     my_colors[3][0] = 0,128,192 // blue
  110.     my_colors[4][0] = 192,96,128 // pink
  111.     my_colors[5][0] = 96,192,96 // green
  112.  
  113. ///////////////////////////
  114. // return the graph data, colors, min value, max value, and increment
  115.  
  116. graph_handler_1: element_name
  117.     return @my_single_data, @my_colors, 0, 100, 10
  118.  
  119. graph_handler_2: element_name
  120.     return @my_multi_data, @my_colors, 0, 100, 10
  121.  
  122. graph_handler_3: element_name
  123.     return @my_stacked_data, @my_colors, 0, 100, 10
  124.  
  125. graph_handler_4: element_name
  126.     return @my_pie_data, @my_colors, 0, 100, 10
  127.  
  128. ///////////////////////////
  129. enable_handler:
  130.     enable all mode enable_flag
  131.     if !enable_flag
  132.         enable element "enable" mode TRUE
  133.  
  134. set_focus:
  135.     set focus "single edit"
  136.  
  137. next_focus:
  138.     next focus
  139.  
  140.